import React, { Component } from 'react'
import ImageView from '../ImageView/ImageView'
import cartStyle from './cartlist.module.scss'

export default class CartList extends Component {
  state = {
    cartList: '---',
  }
  render() {
    const {
      item: { productPic, id, number, price, isSelected },
      handleReduceItem,
      handleAddItem,
      handleSelected,
    } = this.props

    return (
      <div className={cartStyle['cartlist-wrapper']}>
        <div className={cartStyle['cartlist-check']}>
          <input type="checkbox" />
        </div>
        <div className={cartStyle['cartlist-left']}>
          <ImageView src={productPic} />
        </div>
        <div className={cartStyle['cartlist-right']}>
          <span>农夫山泉 NFC 100% 果汁</span>
          <span>{price.toFixed(2)}</span>
          <button onClick={() => handleReduceItem && handleReduceItem(id)}>{'-'}</button>
          <span>{number}</span>
          <button onClick={() => handleAddItem && handleAddItem(id)}>{'+'}</button>
        </div>
      </div>
    )
  }
}
